#include "weiqiantools.h"
#include <QTabWidget>
#include <QGridLayout>
#include <QFile>
#include <QStyleFactory>

#include "serialportwidget.h"
#include "canwidget.h"
#include "otherswidget.h"
#include "watchdogwidget.h"
#include "iotestwidget.h"
#include "configargs.h"


WeiqianTools::WeiqianTools(QWidget *parent)
    : JDialog(parent)
{



    SerialPortWidget    *pSerialPortWidget      = new SerialPortWidget;
 
    IOTestWidget        *pIOTestWidget = new IOTestWidget;
    OthersWidget        *pBackLightWidget       = new OthersWidget;
    				     pWatchDogWidget        = new WatchDogWidget;


    pTextTab = new QTabWidget;

    pTextTab->addTab(pSerialPortWidget, tr("串口测试"));

    if(g_cmdline.contains("can=enable"))
	{
		CanWidget           *pCanWidget             = new CanWidget;
		pTextTab->addTab(pCanWidget,        tr("CAN测试"));
	}
 
    pTextTab->addTab(pWatchDogWidget,   tr("看门狗测试"));
    pTextTab->addTab(pIOTestWidget, tr("IO测试"));
    pTextTab->addTab(pBackLightWidget,  tr("其他测试"));
//pTextTab->setCurrentIndex(1);
    pTextTab->resize(this->size());

    QGridLayout *pMainLayout = new QGridLayout;
    pMainLayout->addWidget(pTextTab, 0, 0, 1, 1);

    this->setJLayout(pMainLayout);
    this->setJTitle(tr("微嵌测试工具"));
}

WeiqianTools::~WeiqianTools()
{
	
	pWatchDogWidget->leaveWithoutclosedog();
	
}


